<template>
  <div id="app">
    <cartList :listItem='listItem' @chooseAll='chooseAll'/>
    <cartFoot class="cartFoot" />
  </div>
</template>
<script>
import cartList from "./components/cartList";
import cartFoot from "./components/cartFooter";
import data from "../public/data";
import Bus from './Bus'
export default {
  components: { cartList, cartFoot },
  data() {
    return {
      listItem: data.result.list
    };
  },
  methods: {
    chooseAll(flag){
      this.list.forEach(item=>{
        item.isFlag = flag
      })
    }
  },
  mounted(){
    Bus.$on('del',(key)=>{
      // console.log(key);
      let index = this.listItem.filter(item=>item.id==key)
      console.log(index);
      // this.listItem.splice(,1)
    })
  }
};
</script>


<style >
.cartFoot {
  position: absolute;
  bottom: 0;
}
</style>
